package com.chinacoal.microservice.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.pojo.CcmsSmartleasingDeviceManagement;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 设备管理-mybatis-plus接口类
 * @date 2020-12-17 10：48
 */
public interface CcmsSmartleasingDeviceManagementMapper extends BaseMapper<CcmsSmartleasingDeviceManagement> {

    /**
     * @Description: 查询所有的设备消息（带分页）
     * @author zhuliang
     * @date 2020/12/17 13:59
     */
    List<CcmsSmartleasingDeviceManagement> getAllByPage(Page<CcmsSmartleasingDeviceManagement> toPage,
                                                        @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                        @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询设备信息（带分页）
     * @author zhuliang
     * @date 2020/12/17 14:12
     */
    List<CcmsSmartleasingDeviceManagement> getAllByCondition(Page<CcmsSmartleasingDeviceManagement> toPage,
                                                             @Param("equipmentSerialNumber") String equipmentSerialNumber,
                                                             @Param("brand") String brand,
                                                             @Param("region") String region,
                                                             @Param("fkEquipmentTypeId") String fkEquipmentTypeId,
                                                             @Param("equipmentName") String equipmentName,
                                                             @Param("fkBuildingId") String fkBuildingId,
                                                             @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                             @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 根据id查询设备信息
     * @author zhuliang
     * @date 2020/12/17 14:23
     */
    CcmsSmartleasingDeviceManagement getDeviceById(@Param("pkDeviceManagementId") String pkDeviceManagementId,
                                                   @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                   @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 添加设备读数和设备信息
     * @author zhuliang
     * @date 2020/12/31 15:20
     */
    void updateByYunDing(@Param("lastUpdateDate") Date lastUpdateDate,
                         @Param("lastUpdatedBy") Integer lastUpdatedBy,
                         @Param("fkYundingHomeId") String fkYundingHomeId,
                         @Param("fkYundingRoomId") String fkYundingRoomId,
                         @Param("deviceReadings") BigDecimal deviceReadings,
                         @Param("readingTimeOfEquipment") Date readingTimeOfEquipment,
                         @Param("id") String id);

    /**
     * @Description: 根据第三方设备uuid查询设备信息
     * @author zhuliang
     * @date 2020/12/31 16:09
     */
    String getDataByYunDing(@Param("id") String id);

    /**
     * @Description: 序列号唯一性查询
     * @author zhuliang
     * @date 2020/12/31 16:28
     */
    String serialNumberUniqueness(@Param("equipmentSerialNumber") String equipmentSerialNumber);

    /**
     * @Description: 修改设备状态
     * @author zhuliang
     * @date 2021/1/8 14:12
     */
    void updateDeviceStatus(@Param("lastUpdateDate") Date lastUpdateDate,
                            @Param("lastUpdatedBy") Integer lastUpdatedBy,
                            @Param("deviceStatus") Byte deviceStatus,
                            @Param("equipmentSerialNumber") String equipmentSerialNumber);

    /**
     * @Description: 根据序列号得到其状态
     * @author zhuliang
     * @date 2021/1/8 14:18
     */
    Byte getStatusByWeiYu(@Param("equipmentSerialNumber") String equipmentSerialNumber);

    /**
     * @Description: 添加绿米数据
     * @author zhuliang
     * @date 2021/1/11 14:38
     */
    void updateByLuMi(@Param("lastUpdateDate") Date lastUpdateDate,
                      @Param("lastUpdatedBy") Integer lastUpdatedBy,
                      @Param("readingTimeOfEquipment") Date readingTimeOfEquipment,
                      @Param("temperatureValue") String temperatureValue,
                      @Param("humidityValue") String humidityValue,
                      @Param("pressureValue") String pressureValue,
                      @Param("id") String id);

    /**
     * @Description: 可视化页面的所有房间信息(左)
     * @author zhuliang
     * @date 2021/1/11 17:45
     */
    List<CcmsSmartleasingDeviceManagement> getAllRoomData();

    /**
     * @Description: 得到对应房间的断路器信息
     * @author zhuliang
     * @date 2021/1/11 17:54
     */
    List<CcmsSmartleasingDeviceManagement> getLineStatus(@Param("region") String region);

    /**
     * @Description: 唯一性验证
     * @author zhuliang
     * @date 2021/1/11 18:18
     */
    String uniquenessVerification(@Param("line") Byte line,
                                  @Param("region") String region,
                                  @Param("building") String building,
                                  @Param("fkEquipmentTypeId") String fkEquipmentTypeId);

    /**
     * @Description: 可视化页面的所有房间信息(右)
     * @author zhuliang
     * @date 2021/1/26 18:43
     */
    CcmsSmartleasingDeviceManagement getAllStatisticalData();

    /**
     * @Description: 房间删除的设备兼容性验证
     * @author zhuliang
     * @date 2021/1/27 12:01
     */
    String deleteRoomByDevice(@Param("region") String[] region);

    /**
     * @Description: 获取指定房间、当月的云丁设备读数，实际值为上个月最后的行度
     * @author zhuliang
     * @date 2022年11月24日
     */
    List<CcmsSmartleasingDeviceManagement> getThisMonthMobilityByRoom(@Param("fkYunDingRoomId") String fkYunDingRoomId);

}
